package cn.anquing.demo.elasticsearch.demo.jpa;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * @author wangqq65
 * @since 2021/4/20 18:04
 */
public interface BlogRepository extends JpaRepository<Blog, Long> {

    @Query("select b from Blog  b where b.title " +
            "like concat('%',:keyword,'%') or  b.content like concat('%',:keyword,'%')")
    List<Blog> search(@Param("keyword") String keyword);

}
